<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <style>
    .content {
      white-space: pre-line;
    }
  </style>
  <body>
    <div id="app"><i>{{name}}{{age}}</i>: <i>{{age}}</i></div>
    <script src="/dist/umd/vue.js"></script>
    <script>
      // 全局组件  Vue.extend 处理后就是一个构造函数
      // Vue.component("my-button", {
      //   template: "<button>点击</button>",
      //   data() {
      //     return {
      //       name: "zaz",
      //     };
      //   },
      // });
      const vm = new Vue({
        el: "#app",
        components: {
          "my-button": {
            // 局部组件， 当全局组件和实例的局部组件重名时，先查找自己的找不到在向上查找
            template: "<div><button>局部</button></div>",
            components: {
              xxx: { template: "<div>局部的内部</div>" },
            },
            data() {
              return { name: "zb" };
            },
          },
        },
        data() {
          return {
            name: "zhangbo",
            age: 28,
            arr: [1, 2, 3,[1,2]],
          };
        },
      });
      vm.name = "wencong";
    </script>
  </body>
</html>
